<?php
namespace Api\Controller;
use Think\Controller;
class StrategyController extends BaseController {


    /**
     *   获取展示信息内容
     */
    public function showDetail(){
        $list = M('strategy')->field('id,title,image,create_at,link')->order('id desc')->select();
        foreach($list as &$b){
            $b['time'] = date("Y-m-d ",strtotime($b['create_at']));
        }
        if($list){
            echo json_encode(array('list'=>$list));
        }else{
            echo json_encode(array('status'=>203,'err'=>'获取信息失败，请检查网络！'));
        }
    }




    /***
     *
     *    获取展示信息的详情
     *
     */
    public function getDetail(){
        $a = 'example.7rose.cn';
        $id = $_REQUEST['id'];
        $list = M('strategy')->where("id = '$id'")->field('content')->find();
        $content = $list['content'];
        $b = str_replace('src="', 'src="https://' . $a, $content);
        if($list){
            echo json_encode(array('content'=>$b));
        }else{
            echo json_encode(array('status'=>203,'err'=>'获取信息失败，请检查网络！'));
        }
    }




    /**
     *   获取拍摄流程信息
     */
    public function showLiu(){
        $list = M('liucheng')->field('id,title,image')->select();
        if($list){
            echo json_encode(array('list'=>$list));
        }else{
            echo json_encode(array('status'=>203,'err'=>'获取信息失败，请检查网络！'));
        }
    }




    /***
     *
     *    获取展示信息的详情
     *
     */
    public function getLiu(){
        $a = 'example.7rose.cn';
        $id = $_REQUEST['id'];
        $list = M('liucheng')->where("id = '$id'")->field('content')->find();
        $content = $list['content'];
        $b = str_replace('src="', 'src="https://' . $a, $content);
        if($list){
            echo json_encode(array('content'=>$b));
        }else{
            echo json_encode(array('status'=>203,'err'=>'获取信息失败，请检查网络！'));
        }
    }






}
